Integrand size = 23, antiderivative size = 67 \[ \int \frac {a+b \sec (e+f x)}{c+d \sec (e+f x)} \, dx=\frac {a x}{c}+\frac {2 (b c-a d) \text {arctanh}\left (\frac {\sqrt {c-d} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c+d}}\right )}{c \sqrt {c-d} \sqrt {c+d} f} \]
[Out]
Time = 0.19 (sec) , antiderivative size = 67, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.174, Rules used = {4004, 3916, 2738, 214} \[ \int \frac {a+b \sec (e+f x)}{c+d \sec (e+f x)} \, dx=\frac {2 (b c-a d) \text {arctanh}\left (\frac {\sqrt {c-d} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c+d}}\right )}{c f \sqrt {c-d} \sqrt {c+d}}+\frac {a x}{c} \]
[In]
[Out]
Rule 214
Rule 2738
Rule 3916
Rule 4004
Rubi steps \begin{align*} \text {integral}& = \frac {a x}{c}-\frac {(-b c+a d) \int \frac {\sec (e+f x)}{c+d \sec (e+f x)} \, dx}{c} \\ & = \frac {a x}{c}-\frac {(-b c+a d) \int \frac {1}{1+\frac {c \cos (e+f x)}{d}} \, dx}{c d} \\ & = \frac {a x}{c}+\frac {(2 (b c-a d)) \text {Subst}\left (\int \frac {1}{1+\frac {c}{d}+\left (1-\frac {c}{d}\right ) x^2} \, dx,x,\tan \left (\frac {1}{2} (e+f x)\right )\right )}{c d f} \\ & = \frac {a x}{c}+\frac {2 (b c-a d) \text {arctanh}\left (\frac {\sqrt {c-d} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c+d}}\right )}{c \sqrt {c-d} \sqrt {c+d} f} \\ \end{align*}
Time = 0.20 (sec) , antiderivative size = 68, normalized size of antiderivative = 1.01 \[ \int \frac {a+b \sec (e+f x)}{c+d \sec (e+f x)} \, dx=\frac {a (e+f x)+\frac {2 (-b c+a d) \text {arctanh}\left (\frac {(-c+d) \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c^2-d^2}}\right )}{\sqrt {c^2-d^2}}}{c f} \]
[In]
[Out]
Time = 0.54 (sec) , antiderivative size = 73, normalized size of antiderivative = 1.09
method | result | size |
derivativedivides | \(\frac {-\frac {2 \left (d a -b c \right ) \operatorname {arctanh}\left (\frac {\left (c -d \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\sqrt {\left (c +d \right ) \left (c -d \right )}}\right )}{c \sqrt {\left (c +d \right ) \left (c -d \right )}}+\frac {2 a \arctan \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{c}}{f}\) | \(73\) |
default | \(\frac {-\frac {2 \left (d a -b c \right ) \operatorname {arctanh}\left (\frac {\left (c -d \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\sqrt {\left (c +d \right ) \left (c -d \right )}}\right )}{c \sqrt {\left (c +d \right ) \left (c -d \right )}}+\frac {2 a \arctan \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{c}}{f}\) | \(73\) |
risch | \(\frac {a x}{c}+\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}-\frac {i c^{2}-i d^{2}-\sqrt {c^{2}-d^{2}}\, d}{\sqrt {c^{2}-d^{2}}\, c}\right ) d a}{\sqrt {c^{2}-d^{2}}\, f c}-\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}-\frac {i c^{2}-i d^{2}-\sqrt {c^{2}-d^{2}}\, d}{\sqrt {c^{2}-d^{2}}\, c}\right ) b}{\sqrt {c^{2}-d^{2}}\, f}-\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i c^{2}-i d^{2}+\sqrt {c^{2}-d^{2}}\, d}{\sqrt {c^{2}-d^{2}}\, c}\right ) d a}{\sqrt {c^{2}-d^{2}}\, f c}+\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i c^{2}-i d^{2}+\sqrt {c^{2}-d^{2}}\, d}{\sqrt {c^{2}-d^{2}}\, c}\right ) b}{\sqrt {c^{2}-d^{2}}\, f}\) | \(294\) |
[In]
[Out]
none
Time = 0.28 (sec) , antiderivative size = 250, normalized size of antiderivative = 3.73 \[ \int \frac {a+b \sec (e+f x)}{c+d \sec (e+f x)} \, dx=\left [\frac {2 \, {\left (a c^{2} - a d^{2}\right )} f x - {\left (b c - a d\right )} \sqrt {c^{2} - d^{2}} \log \left (\frac {2 \, c d \cos \left (f x + e\right ) - {\left (c^{2} - 2 \, d^{2}\right )} \cos \left (f x + e\right )^{2} - 2 \, \sqrt {c^{2} - d^{2}} {\left (d \cos \left (f x + e\right ) + c\right )} \sin \left (f x + e\right ) + 2 \, c^{2} - d^{2}}{c^{2} \cos \left (f x + e\right )^{2} + 2 \, c d \cos \left (f x + e\right ) + d^{2}}\right )}{2 \, {\left (c^{3} - c d^{2}\right )} f}, \frac {{\left (a c^{2} - a d^{2}\right )} f x + {\left (b c - a d\right )} \sqrt {-c^{2} + d^{2}} \arctan \left (-\frac {\sqrt {-c^{2} + d^{2}} {\left (d \cos \left (f x + e\right ) + c\right )}}{{\left (c^{2} - d^{2}\right )} \sin \left (f x + e\right )}\right )}{{\left (c^{3} - c d^{2}\right )} f}\right ] \]
[In]
[Out]
\[ \int \frac {a+b \sec (e+f x)}{c+d \sec (e+f x)} \, dx=\int \frac {a + b \sec {\left (e + f x \right )}}{c + d \sec {\left (e + f x \right )}}\, dx \]
[In]
[Out]
Exception generated. \[ \int \frac {a+b \sec (e+f x)}{c+d \sec (e+f x)} \, dx=\text {Exception raised: ValueError} \]
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. 274 vs. \(2 (58) = 116\).
Time = 0.33 (sec) , antiderivative size = 274, normalized size of antiderivative = 4.09 \[ \int \frac {a+b \sec (e+f x)}{c+d \sec (e+f x)} \, dx=\frac {\frac {{\left (\sqrt {-c^{2} + d^{2}} a {\left (c - 2 \, d\right )} {\left | -c + d \right |} + \sqrt {-c^{2} + d^{2}} b c {\left | -c + d \right |} - \sqrt {-c^{2} + d^{2}} a {\left | c \right |} {\left | -c + d \right |} + \sqrt {-c^{2} + d^{2}} b {\left | c \right |} {\left | -c + d \right |}\right )} {\left (\pi \left \lfloor \frac {f x + e}{2 \, \pi } + \frac {1}{2} \right \rfloor + \arctan \left (\frac {\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )}{\sqrt {-\frac {d + \sqrt {{\left (c + d\right )} {\left (c - d\right )} + d^{2}}}{c - d}}}\right )\right )}}{{\left (c^{2} - 2 \, c d + d^{2}\right )} c^{2} + {\left (c^{2} d - 2 \, c d^{2} + d^{3}\right )} {\left | c \right |}} + \frac {{\left (a c + b c - 2 \, a d + a {\left | c \right |} - b {\left | c \right |}\right )} {\left (\pi \left \lfloor \frac {f x + e}{2 \, \pi } + \frac {1}{2} \right \rfloor + \arctan \left (\frac {\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )}{\sqrt {-\frac {d - \sqrt {{\left (c + d\right )} {\left (c - d\right )} + d^{2}}}{c - d}}}\right )\right )}}{c^{2} - d {\left | c \right |}}}{f} \]
[In]
[Out]
Time = 15.63 (sec) , antiderivative size = 573, normalized size of antiderivative = 8.55 \[ \int \frac {a+b \sec (e+f x)}{c+d \sec (e+f x)} \, dx=\frac {b\,c^2\,\ln \left (\frac {c\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )-d\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )+\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {c^2-d^2}}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )}{f\,{\left (c^2-d^2\right )}^{3/2}}-\frac {b\,d^2\,\ln \left (\frac {c\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )-d\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )+\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {c^2-d^2}}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )}{f\,{\left (c^2-d^2\right )}^{3/2}}+\frac {2\,a\,c\,\mathrm {atan}\left (\frac {\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )}{f\,\left (c^2-d^2\right )}-\frac {b\,\ln \left (\frac {c\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )+d\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )-\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {c^2-d^2}}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )\,\sqrt {\left (c+d\right )\,\left (c-d\right )}}{f\,\left (c^2-d^2\right )}-\frac {a\,c\,d\,\ln \left (\frac {c\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )-d\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )+\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {c^2-d^2}}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )}{f\,{\left (c^2-d^2\right )}^{3/2}}-\frac {2\,a\,d^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )}{c\,f\,\left (c^2-d^2\right )}+\frac {a\,d^3\,\ln \left (\frac {c\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )-d\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )+\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {c^2-d^2}}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )}{c\,f\,{\left (c^2-d^2\right )}^{3/2}}+\frac {a\,d\,\ln \left (\frac {c\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )+d\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )-\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {c^2-d^2}}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )\,\sqrt {\left (c+d\right )\,\left (c-d\right )}}{c\,f\,\left (c^2-d^2\right )} \]
[In]
[Out]